//
//  ApplyInCompanyScaleCell.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/8/29.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "ApplyInCompanyScaleCell.h"

@interface ApplyInCompanyScaleCell()

@property(nonatomic,strong)NSMutableArray *dataArray;

@end

@implementation ApplyInCompanyScaleCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.text = @"企业规模";
        titleLabel.font = [UIFont systemFontOfSize:15];
        titleLabel.textColor = COLOR_HEX(0x121212);
        [self.contentView addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView);
            make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(10));
            make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(100), scaleTopAndBottom(20)));
        }];
        
    }
    return self;
}

///**
// 创建人数选择按钮
// */
//-(void)createBackLabelunderLabel:(UILabel *)label{
//    self.fistrBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.fistrBtn.layer.borderWidth = 1.0f;
//    self.fistrBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    [self.contentView addSubview:self.fistrBtn];
//
//    self.secondBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.secondBtn.layer.borderWidth = 1.0f;
//    self.secondBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    [self.contentView addSubview:self.secondBtn];
//
//    self.threeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.threeBtn.layer.borderWidth = 1.0f;
//    self.threeBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    [self.contentView addSubview:self.threeBtn];
//
//    self.fourBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.fourBtn.layer.borderWidth = 1.0f;
//    self.fourBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    [self.contentView addSubview:self.fourBtn];
//
//    self.fiveBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.fiveBtn.layer.borderWidth = 1.0f;
//    self.fiveBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    [self.contentView addSubview:self.fiveBtn];
//
//    self.sixBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.sixBtn.layer.borderWidth = 1.0f;
//    self.sixBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    [self.contentView addSubview:self.sixBtn];
//
//    [self.fistrBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(20));
//        make.height.mas_equalTo(scaleTopAndBottom(20));
//        make.top.equalTo(label.mas_bottom).offset(scaleTopAndBottom(5));
//    }];
//    [self.secondBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.fistrBtn.mas_right).offset(scaleLeftAndRight(20));
//        make.height.mas_equalTo(scaleTopAndBottom(20));
//        make.top.equalTo(label.mas_bottom).offset(scaleTopAndBottom(5));
//    }];
//    [self.threeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.secondBtn.mas_right).offset(scaleLeftAndRight(20));
//        make.height.mas_equalTo(scaleTopAndBottom(20));
//        make.top.equalTo(label.mas_bottom).offset(scaleTopAndBottom(5));
//        make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-20));
//        make.width.equalTo(@[self.secondBtn,self.fistrBtn]);
//    }];
//    [self.fourBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(20));
//        make.height.mas_equalTo(scaleTopAndBottom(20));
//        make.top.equalTo(self.fistrBtn.mas_bottom).offset(scaleTopAndBottom(5));
//    }];
//    [self.fiveBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.fourBtn.mas_right).offset(scaleLeftAndRight(20));
//        make.height.mas_equalTo(scaleTopAndBottom(20));
//        make.top.equalTo(self.secondBtn.mas_bottom).offset(scaleTopAndBottom(5));
//    }];
//    [self.sixBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.fiveBtn.mas_right).offset(scaleLeftAndRight(20));
//        make.height.mas_equalTo(scaleTopAndBottom(20));
//        make.top.equalTo(self.threeBtn.mas_bottom).offset(scaleTopAndBottom(5));
//         make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-20));
//        make.width.equalTo(@[self.fiveBtn,self.fourBtn]);
//    }];
//    [self.fistrBtn setTitle:@"100人以下" forState:UIControlStateNormal];
//    [self.fistrBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.secondBtn setTitle:@"100-500人" forState:UIControlStateNormal];
//    [self.secondBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.threeBtn setTitle:@"500-1000人" forState:UIControlStateNormal];
//    [self.threeBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.fourBtn setTitle:@"1000-5000人" forState:UIControlStateNormal];
//    [self.fourBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.fiveBtn setTitle:@"5000-10000人" forState:UIControlStateNormal];
//    [self.fiveBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.sixBtn setTitle:@"10000人以上" forState:UIControlStateNormal];
//    [self.sixBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    self.fistrBtn.titleLabel.adjustsFontSizeToFitWidth = YES;;
//    self.secondBtn.titleLabel.adjustsFontSizeToFitWidth = YES ;
//    self.threeBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
//    self.fourBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
//    self.fiveBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
//    self.sixBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
//    [self.fistrBtn addTarget:self action:@selector(getCompanyPeopleCount:) forControlEvents:UIControlEventTouchUpInside];
//        [self.secondBtn addTarget:self action:@selector(getCompanyPeopleCount:) forControlEvents:UIControlEventTouchUpInside];
//        [self.threeBtn addTarget:self action:@selector(getCompanyPeopleCount:) forControlEvents:UIControlEventTouchUpInside];
//        [self.fourBtn addTarget:self action:@selector(getCompanyPeopleCount:) forControlEvents:UIControlEventTouchUpInside];
//        [self.fiveBtn addTarget:self action:@selector(getCompanyPeopleCount:) forControlEvents:UIControlEventTouchUpInside];
//        [self.sixBtn addTarget:self action:@selector(getCompanyPeopleCount:) forControlEvents:UIControlEventTouchUpInside];
//    self.fistrBtn.tag = 2001;
//    self.secondBtn.tag = 2002;
//    self.threeBtn.tag = 2003;
//    self.fourBtn.tag = 2004;
//    self.fiveBtn.tag = 2005;
//    self.sixBtn.tag = 2006;
//
//}
-(void)getCompanyPeopleCount:(UIButton *)btn{
    
    NSLog(@"%@",btn.titleLabel.text);
    
    
    if (btn != self.selectedBtn) {
        
        self.selectedBtn.backgroundColor = [UIColor whiteColor];
        
        self.selectedBtn.selected = NO;
        
        btn.selected = YES;
        
        btn.backgroundColor = [UIColor cyanColor];
        
        self.selectedBtn = btn;
        
    }else{
        
        self.selectedBtn.selected = YES;
        
    }
}




-(NSMutableArray *)dataArray{
    if (_dataArray == nil) {
        _dataArray = [[NSMutableArray alloc] init];
    }
    return _dataArray;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
